const defaultState = {
    vehiclePrices: [],
    filter:{}
};
export default function clientVehicleFee(state = defaultState, action) {
    const {type, payload} = action;
    switch (type) {
        case 'CARRIER.VEHICLE_FEE':
        case 'CLIENT.VEHICLE_FEE':
        case 'CLIENT.VEHICLE_FEE_QUERY':
            const data = [];
            payload && payload.forEach(item => {
                data.push({...item})
            });
            return {...state, vehiclePrices: [...data]};
        case "CLIENT.VEHICLE_FEE_QUERY_PENDING":
            return {...state, filter: {...payload}};
        case "CARRIER.HIDE_CREATE":
        case "CARRIER.HIDE_MODIFY":
            return {...state, vehiclePrices: []};
        default:
            return state;
    }
}

